package com.jt.www.enums.woxuebao;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author admin_ltf
 * @create 2019-05-30 19:02
 */
public enum JNXPXEnum {


    jc1("19XE992496", "1", "19XEZ786842", "20000.0"),
    jc2("19XE992496", "2", "19XEZ318698", "60000.0"),
    jc3("19XE992496", "3", "19XEZ798778", "80000.0"),

    jc4("19XE932940", "1", "19XEZ211858", "20000.0"),
    jc5("19XE932940", "2", "19XEZ102176", "60000.0"),
    jc6("19XE932940", "3", "19XEZ713920", "80000.0"),


    jc7("19XE992690", "1", "19XEZ540653", "3000.0"),
    jc8("19XE992690", "2", "19XEZ576456", "7000.0"),
    jc9("19XE992690", "3", "19XEZ557707", "8000.0"),

    jc10("19XE349177", "1", "19XEZ307925", "15000.0"),
    jc11("19XE349177", "2", "19XEZ768632", "25000.0"),
    jc12("19XE349177", "3", "19XEZ680229", "30000.0"),

    jc13("19XE309256", "1", "19XEZ385214", "3600.0"),
    jc14("19XE309256", "2", "19XEZ541601", "7200.0"),
    jc15("19XE309256", "3", "19XEZ115907", "9000.0"),

    jc16("19XE810080", "1", "19XEZ210239", "10000.0"),
    jc17("19XE810080", "2", "19XEZ755426", "25000.0"),
    jc18("19XE810080", "3", "19XEZ755426", "25000.0"),

    jc19("19XE961044", "1", "19XEZ351585", "3000.0"),
    jc20("19XE961044", "2", "19XEZ991153", "7000.0"),
    jc21("19XE961044", "3", "19XEZ376034", "10000.0");

    private String code;

    private String level;// 1 基础 2 加强  3强化版

    private String valueCode;

    private String value;

    JNXPXEnum(String code, String level, String valueCode, String value) {
        this.code = code;
        this.level = level;
        this.valueCode = valueCode;
        this.value = value;
    }


    public static Map<String, String> getRiskLimit(String code, String productLevel) {
        Map<String, String> map = new HashMap<>();
        if (StringUtils.isEmpty(productLevel) || StringUtils.isEmpty(code)) {
            return map;
        }
        for (JNXPXEnum hTCXAKEnum : JNXPXEnum.values()) {
            if (productLevel.equals(hTCXAKEnum.level) && code.equals(hTCXAKEnum.code)) {
                map.put("value", hTCXAKEnum.value);
                map.put("valueCode", hTCXAKEnum.valueCode);
            }
        }

        return map;
    }

    public String getCode() {
        return code;
    }

    public String getLevel() {
        return level;
    }

    public String getValueCode() {
        return valueCode;
    }

    public String getValue() {
        return value;
    }
}
